﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace MyFramework
{
    public partial class MonoBehaviourSimplify : MonoBehaviour
    {
        #region  TimeSys
        /// <summary>
        /// 用于确保始终只有一个TimeSys存在
        /// </summary>
        private static TimeSys mSaveTimeSys = null;
        /// <summary>
        /// 对于游戏物体可用的TimeSys
        /// </summary>
        private TimeSys mTimeSys;
        protected TimeSys _TimeSys
        {
            get
            {
                if (mSaveTimeSys == null)
                {
                    GameObject gameObj = new GameObject("TimeSys");
                    mSaveTimeSys = gameObj.AddComponent<TimeSys>();
                    mSaveTimeSys.Init();
                }
                mTimeSys = mSaveTimeSys;
                return mTimeSys;
            }
        }
        #endregion

        protected virtual void Awake()
        {


        }

        public void Show()
        {
            GameObjectSimplify.Show(gameObject);
        }

        public void Hide()
        {
            GameObjectSimplify.Hide(gameObject);
        }

        public void Identity()
        {
            TransformSimplify.Identity(gameObject.transform);
        }

        protected virtual void OnBeforeDestroy()
        {

        }

    }
}
